package response.admin;

import admin.AdminBusiness;
import cn.hutool.core.date.DateUtil;
import enums.DeletedStatus;

import java.util.Date;

/**
 * created by weiwei on 2018-02-23
 * 业务、功能 返回信息
 */
public class AdminBusinessDTO {

    /**
     * id
     */
    public String id;


    /**
     * 业务编号
     */
    public String code;

    /**
     * 业务名称
     */
    public String name;

    /**
     * Controller名称
     */
    public String controllerName;

    /**
     * action 名称
     */
    public String actionName;

    /**
     * 父节点ID
     */
    public String parentId;

    /**
     * 是否为叶子节点
     */
    public Boolean isLeaf;

    /**
     * 节点全路径
     */
    public String nodeIdPath;

    /**
     * 排序号
     */
    public Integer showOrder;

    public String remark;

    public DeletedStatus deleted;
    /**
     * 创建时间.
     */
    public String createdAt;




    /**
     * 更新时间.
     */
    public Date modifyAt;




    public static AdminBusinessDTO from(AdminBusiness business){
        AdminBusinessDTO businessDTO = new AdminBusinessDTO();
        businessDTO.id = business.id ;
        businessDTO.code = business.code ;
        businessDTO.name = business.name ;
        businessDTO.controllerName = business.controllerName ;
        businessDTO.actionName = business.actionName ;
        businessDTO.parentId = business.parentId ;
        businessDTO.isLeaf = business.isLeaf ;
        businessDTO.nodeIdPath = business.nodeIdPath ;
        businessDTO.showOrder = business.showOrder ;
        businessDTO.remark = business.remark ;
        businessDTO.deleted = business.deleted ;
        businessDTO.createdAt = DateUtil.formatDateTime(business.createdAt) ;
        businessDTO.modifyAt = business.modifyAt ;
        return businessDTO ;

    }

}
